﻿using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace THE_WIND_RISES.Common.Domans.Persisted
{
    /// <summary>
    /// 流程审批表(代办)
    /// </summary>
    [Table("WorkflowAuditor")]
    public class PersistedWorkflowAuditor
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 发起流程的实例ID
        /// </summary>
        [MaxLength(50)]
        public string WorkflowId { get; set; }

        /// <summary>
        /// 流程定义ID
        /// </summary>
        [MaxLength(50)]
        public string WorkflowDefinitionId { get; set; }

        /// <summary>
        /// 当前执行节点(流程引擎用的)
        /// </summary>
        public Guid ExecutionPointerId { get; set; }

        /// <summary>
        /// 当前审核步骤节点ID(前端传过来的)
        /// </summary>
        [MaxLength(50)]
        public string StepId { get; set; } = null!;
        /// <summary>
        /// 当前审核步骤节点名称
        /// </summary>
        [MaxLength(50)]
        public string StepName { get; set; } = null!;

        /// <summary>
        /// 状态
        /// </summary>
        public WorkFlowAuditStatus Status { get; set; }

        /// <summary>
        /// 动作类型:0-暂存,1-提交,2-驳回,3-审批,4-废弃,5-沟通,6-催办,7-抄送,8-传阅,9-转办
        /// </summary>
        public OperateType OperateType { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AuditTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(300)]
        public string? Remark { get; set; }

        /// <summary>
        /// 审核人Id
        /// </summary>
        public long? UserId { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [MaxLength(50)]
        public string? UserName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; } = DateTime.Now;
    }
    // 审批状态
    public enum WorkFlowAuditStatus
    {
        /// <summary>
        /// 待审核
        /// </summary>
        [Description("待审核")]
        UnAudited = 0,

        /// <summary>
        /// 审核通过
        /// </summary>
        [Description("审核")]
        Pass = 1,

        /// <summary>
        /// 驳回
        /// </summary>
        [Description("驳回")]
        UnApprove = 2,
        /// <summary>
        /// 驳回至历史
        /// </summary>
        [Description("驳回至历史")]
        RejectToHistory = 3
    }
    /// <summary>
    /// 按钮的操作类型
    /// </summary>
    public enum OperateType
    {
        /// <summary>
        /// 暂存
        /// </summary>
        [Description("暂存")]
        Save = 0,

        /// <summary>
        /// 提交
        /// </summary>
        [Description("提交")]
        Start = 1,

        /// <summary>
        /// 驳回
        /// </summary>
        [Description("驳回")]
        Sendback = 2,

        /// <summary>
        /// 审批
        /// </summary>
        [Description("审批")]
        Approval = 3,

        /// <summary>
        /// 废弃
        /// </summary>
        [Description("废弃")]
        Abandon = 4,

        /// <summary>
        /// 沟通
        /// </summary>
        [Description("沟通")]
        StartQuery = 5,

        /// <summary>
        /// 催办
        /// </summary>
        [Description("催办")]
        HastenWork = 6,

        /// <summary>
        /// 抄送
        /// </summary>
        [Description("抄送")]
        CopySend = 7,

        /// <summary>
        /// 传阅
        /// </summary>
        [Description("传阅")]
        Encyclic = 8,

        /// <summary>
        /// 转办
        /// </summary>
        [Description("转办")]
        Tranfer = 9,

        /// <summary>
        /// 异常
        /// </summary>
        [Description("异常")]
        Exception = 10,

        /// <summary>
        /// 重新提交
        /// </summary>
        [Description("重新提交")]
        Restart = 11,
        /// <summary>
        /// 查看
        /// </summary>
        [Description("查看")]
        Review = 12
    }
}
